<template>
	<view class="flex-col page">
		<u-navbar title="任务列表" title-color="#333" :background="background"></u-navbar>
	  <view class="flex-col list">
	    <view
	      class="flex-row justify-between items-center list-item mt-15"
	      v-for="(item,index) in list"
	      :key="index"
	      @click="toDetail(item)"
	    >
	      <view class="flex-row items-center" style="flex: 1;width: 100%;">
	        <text class="font_2">{{item.title}}</text>
	      </view>
	      <view class="flex-col justify-center items-end group_2">
	       {{item.time}}
	      </view>
	    </view>
	  </view>
	</view>
</template>

<script>
	import {
		getTaskList
	} from '../../haoduogeni/common/api/user';
	export default {
		data() {
			return {
				list: [],
				    uid: '',
				    page: 1,
				    row: 10,
				    last_page: 1
			}
		},
		onLoad(options) {
		    this.uid = options.uid;
		    this.getList()
		  },
		  onReachBottom() {
		      console.log('走了么')
		      if(this.page < this.last_page){
		        this.page++;
		        this.getList()
		      }else {
		        uni.showToast({
		          title: '已加载全部',
		          icon: 'none'
		        })
		      }
		    },
		methods: {
			getList(){
			    var _this = this;
			    getTaskList({
			      page: this.page,
			      row: this.row,
			      pt_id: this.$ptId,
			      uid: uni.getStorageSync('userId'),
			    }).then(res => {
			      //成功时回调函数
			      console.log(res, 'getWxUser')
			      if (res.errno == 0) {
			        var data = res.data.data;
			        console.log(data,'aaaaaaaaaa')
			        this.list = [...this.list,...data];
			        this.last_page = res.data.last_page;
			      } else {
			        uni.showToast({
			          title: res.msg,
			          icon: 'none'
			        })
			      }
			    }).catch(err => {
			      //失败时回调函数
			      console.log(err)
			    })
			    
			  },
			  toDetail(item){
			      console.log(item.renwu_id,'详情')
			      var id = item.renwu_id;
			      uni.navigateTo({
			        url: '/haoduogeni/planDetail/index?id=' + id,
			      })
			    },
		}
	}
</script>
<style>
	page {
	  background-color: #f7f7f7;
	  width: 100%;
	  height: 100%;
	}
</style>
<style lang="less" scoped>
	@import url("../common/css/common.css");
.mt-15 {
  margin-top: 30rpx;
}
.ml-15-5 {
  margin-left: 31rpx;
}

.page {
  padding: 0rpx 27rpx 89rpx;
  
}
.image {
  margin-left: 38rpx;
  margin-right: 3rpx;
  width: 655rpx;
  height: 24rpx;
}
.group {
  margin-top: 62rpx;
}
.image_2 {
  width: 20rpx;
  height: 35rpx;
}
.pos {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
.text {
  color: #000000;
  font-size: 36rpx;
  font-family: PingFang SC;
  font-weight: 500;
  line-height: 34rpx;
}
.list {
  margin-top: 44rpx;
  padding: 0 3rpx;
}
.list-item {
  padding: 34rpx 28rpx;
  background-color: #ffffff;
  box-shadow: 0rpx 4rpx 5.64rpx 0.36rpx #e2e2e224;
  border-radius: 16rpx;
}
.list-item:first-child {
  margin-top: 0;
}
.font_2 {
  font-size: 30rpx;
  font-family: PingFang SC;
  /* line-height: 23rpx; */
  font-weight: 500;
  color: #000000;
  width: 100%;
  word-break: break-all;
}
.font {
  font-size: 30rpx;
  font-family: PingFang SC;
  line-height: 28rpx;
  font-weight: 500;
  color: #000000;
}
.group_2 {
  padding: 4rpx 0;
  /* width: 290rpx; */
}
.image_4 {
  width: 64rpx;
  height: 64rpx;
}
.image_3 {
  width: 72rpx;
  height: 72rpx;
}
.pos_2 {
  position: absolute;
  left: 40rpx;
  bottom: 0;
}
.pos_3 {
  position: absolute;
  left: 85rpx;
  bottom: 0;
}
.pos_4 {
  position: absolute;
  right: 89rpx;
  bottom: 0;
}
.pos_5 {
  position: absolute;
  right: 44rpx;
  bottom: 0;
}
.pos_6 {
  position: absolute;
  right: 0;
  bottom: 0;
}
</style>
